package com.yingxin.yx.framework.encrpty.rsa;


import com.yingxin.yx.framework.commons.helper.PropertiesHelper;
import com.yingxin.yx.framework.encrpty.EncryptConst;

/**
 * @author fanchao
 */
public class RsaUtil {

    public static String decryptByPrivateKey(String password) {
        String rsaPwd = PropertiesHelper.getInstance().getProperty(EncryptConst.RSA_PWD);
        if (Boolean.TRUE.equals(Boolean.valueOf(rsaPwd))) {
            String privateKey = PropertiesHelper.getInstance().getProperty(EncryptConst.RSA_PRIVATE_KEY);
            return RsaDigestsHelper.decryptByPrivateKey(privateKey, password);
        } else {
            return password;
        }
    }

}
